<template>
    <div class="tree">
        <el-tree
          :data="data"
          ref="rootTree"
          show-checkbox
          node-key="id"
          :default-checked-keys="$store.state.role.checked_keys||[]"
          :props="defaultProps"
          :default-expand-all='true'
          >
        </el-tree>
    </div>
</template>
<script>
    export default{
        data() {
            return {
                data: [],
                defaultProps: {
                  children: 'children',
                  label: 'authName'
                },
                default_checked_keys:[],
                getCurrentNode:[]
            }
        },
        methods:{
           
        },
        watch:{
           '$store.state.role.AllRights':{
               handler:function(newVal,oldVal){
                   this.data=newVal;
               },
               immediate:true,
               deep:true
           },
           /* '$store.state.role.checked_keys':{
               handler:function(newVal,oldVal){
                   this.default_checked_keys=newVal;
               },
               immediate:true,
               deep:true
           }  */
        },
       mounted(){
            this.$store.commit('role/CHANGE_TREE_OBJECT',this.$refs)
       }
        
    }
</script>
<style lang="scss">
    
</style>